package site.eblog.webService;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

import javax.jws.WebService;import org.aspectj.weaver.bcel.AtAjAttributes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import site.eblog.dao.ArticleMapper;
import site.eblog.entity.Article;
import site.eblog.entity.WebServiceReturn;
import site.eblog.webService.FightingWS;

@WebService(endpointInterface="site.eblog.webService.FightingWS") //endpointInterface这个不能写错了
public class FightingWSImpl implements FightingWS {
	
	@Autowired ArticleMapper articleMapper;
	
	@Override
	public String fight(String name,String pwd) {
		System.out.println("OK!");
		return "名字：" + name + "密码：" + pwd;
	}

	@Override
	public WebServiceReturn webServiceGetArticle(String key) {
		List<Article> articles = new ArrayList<Article>();
		WebServiceReturn webServiceReturn = new WebServiceReturn();
		if(key.equals("articles")){
			articles = articleMapper.webServiceGetArticle();
			webServiceReturn.setResult("成功！");
			webServiceReturn.setArticles(articles);
			return webServiceReturn;
		}
		else{
			webServiceReturn.setResult("key不对！");
			return webServiceReturn;
		}
		
	}

}
